package com.nantian.security.repository;

import com.nantian.model.security.User;
import org.springframework.data.jpa.repository.JpaRepository;

/**
 * Created by huozongsheng on 20.03.16.
 */
public interface UserRepository extends JpaRepository<User, Long> {
    User findByUsername(String username);

    User findByPhoneNum(String phoneNum);
//    @Query(value = "select count (*) from user u WHERE u.username = ?1",nativeQuery = true)
    boolean existsUserByUsername(String username);
//    @Query(value = "SELECT * FROM activity",nativeQuery = true)
//    List<ActivityEntity> test();
//    @Query(value = "SELECT * FROM user,user_authority authority WHERE user.id =?1 AND authority.user_id = user.id AND user.username =?2",nativeQuery = true)
//    List<> test(@Param("id") int id,@Param("name") String name);
    User findById(long id);
    User findByUserid(String userid);
}
